#!/usr/bin/env python
# coding=utf-8

import math

ans = 0;
for i in range(1, 1000 + 1):
    ans += pow(i, i)
print(ans % pow(10, 10))
